package cc.facesign.admin.listener;

import cc.facesign.admin.bean.mq.SignMq;
import cc.facesign.admin.service.TblConfUserService;
import cc.facesign.admin.utils.MqUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 会议签到mq监听
 */
@Component
@RabbitListener(queues = {MqUtils.SING_ROUTER})
@Slf4j
public class SignMqListener {

    @Autowired
    private TblConfUserService confUserService;

    /**
     * 会议签到
     */
    @RabbitHandler
    public void getSignMessage(SignMq mq) {
        log.info("签到消息处理=> {}", mq);
        confUserService.modifyStatus(mq.getCode(), mq.getCardId(), mq.getStatus());
    }
}
